package org.jeecg.modules.business.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.business.entity.BusMeetingRoom;
import org.jeecg.modules.business.mapper.BusMeetingRoomMapper;
import org.jeecg.modules.business.service.IBusMeetingRoomService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description: bus_meeting_room
 * @Author: jeecg-boot
 * @Date:   2023-03-15
 * @Version: V1.0
 */
@Service
public class BusMeetingRoomServiceImpl extends ServiceImpl<BusMeetingRoomMapper, BusMeetingRoom> implements IBusMeetingRoomService {

    @Resource
    private BusMeetingRoomMapper busMeetingRoomMapper;

    /**
     * 获取当前酒店的所有启用的 会议室数据
     * @param hotelId
     * @return
     */
    public List<BusMeetingRoom> fetch(String hotelId){
        if(StringUtils.isBlank(hotelId)) return new ArrayList<>();
        return busMeetingRoomMapper.selectList(Wrappers.<BusMeetingRoom>lambdaQuery().eq(BusMeetingRoom::getHotelId,hotelId).eq(BusMeetingRoom::getStatus, 1));
    }
}
